<template>
	<view>
		<view class="u-page">
			<!-- 所有内容的容器 -->

			<home ref="ishome" v-if="current===0"></home>
			<list ref="isfenlei" v-if="current===1"></list>
			<find ref="isfind" v-if="current===3"></find>
			<my ref="ismy" v-if="current===4"></my>

		</view>
		<!-- 与包裹页面所有内容的元素u-page同级，且在它的下方 -->
		<u-tabbar v-model="current" :list="list" :mid-button="true" :before-switch="beforeSwitch"></u-tabbar>
	</view>
</template>

<script>
	import home from './home.vue'
	import list from './list.vue'
	import find from './find.vue'
	import my from './my.vue'

	export default {
		components: {
			home,
			list,
			find,
			my
		},
		data() {
			return {
				list: [{
						iconPath: "/static/tabbar/aa.png",
						selectedIconPath: "/static/tabbar/a.png",
						text: '首页',
						count: 2,
						isDot: true
					},
					{
						iconPath: "/static/tabbar/bb.png",
						selectedIconPath: "/static/tabbar/b.png",
						text: '分类'
					},
					{
						iconPath: "/static/tabbar/min_button_select.png",
						selectedIconPath: "/static/tabbar/min_button.png",
						text: '发布',
						midButton: true
					},
					{
						iconPath: "/static/tabbar/cc.png",
						selectedIconPath: "/static/tabbar/c.png",
						text: '发现'
					},
					{
						iconPath: "/static/tabbar/dd.png",
						selectedIconPath: "/static/tabbar/d.png",
						text: '我的',
						count: 23,
						isDot: false
					},
				],
				current: 0
			}
		},
		methods: {
			beforeSwitch(index) {

				if (index === 2) {
					uni.navigateTo({
						url: '../push/push'
					});
					return false
				} else {
					return true
				}

			}
		}
	}
</script>
<style lang="less" scoped>
	/deep/ .u-tabbar__content {
		height: 100rpx !important;
	}
</style>